const assert = require('assert');
const { loadApi } = require('@xbl/raml-mocker');

it('Case Name', async () => {<%
  restAPIArr.forEach((restAPI, index) => {
    const methodName = `${restAPI.method.toLowerCase()}Fn${index}`;
    const uriParam = JSON.stringify(restAPI.uriParameters) || '{}';
    let bodyData = '{}';
    if (restAPI.body) {
      if (isJSONType(restAPI.body.mimeType)) {
        bodyData = restAPI.body.text;
      } else {
        bodyData = `'${restAPI.body.text}'`;
      }
    }
    const queryParameters = Parameter.toJSON(restAPI.queryParameters);
    const params = [uriParam, JSON.stringify(queryParameters), bodyData].join(',');
  %>
  const <%= methodName %> = loadApi('<%= restAPI.description %>');
  const { status: status<%= index%>, data: data<%= index%> } = await <%= methodName %>(<%= params %>);

  assert.equal(status<%= index%>, 200);
  // TODO: assert
<% }) %>
});
